package com.pos.clothes.service.serviceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pos.clothes.mapper.SizeMapper;
import com.pos.clothes.pojo.Category;
import com.pos.clothes.pojo.Size;
import com.pos.clothes.service.SizeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class SizeServiceImpl implements SizeService {
    @Autowired
    private SizeMapper mapper;
//    @Override
//    @Transactional(rollbackFor = { RuntimeException.class, Exception.class })
//    public PageInfo getSize(int pageNum, int pageSize) throws Exception {
//        //使用分页插件,核心代码就这一行
//        PageHelper.startPage(pageNum, pageSize);
//        /* 获取 */
//        List<Size> typeList = mapper.getSize();
//        PageInfo pageInfo  = new PageInfo(typeList);
//        return pageInfo;
//    }
    @Override
    public List<Size> getSize() {
        return mapper.getSize();
    }

    @Override
    public void insertSize(Size size) {
        mapper.insertSize(size);
    }

    @Override
    public int deleteSize(int idsize) {
        return mapper.deleteSize(idsize);
    }

    @Override
    public void updateSize(Size size) {
        mapper.updateSize(size);
    }

    @Override
    public List<Size> searchSize(String size) {
        return mapper.searchSize(size);
    }
}
